package com.example.demo.service.impl;

import com.example.demo.dao.UserMapper;
import com.example.demo.model.User;
import com.example.demo.service.UserService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@DubboService(timeout = 5000) //com.example.demo.dubbo.DubboUserService
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Transactional
    public int deleteUserById(String id){
        return userMapper.deleteUserById(id);
    }

    @Transactional
    public int insertUser(User record){
        return userMapper.insertUser(record);
    }

    public User findUser(User record){
        return userMapper.findUser(record);
    }

    @Transactional
    public int updateUser(User record){
        return userMapper.updateUser(record);
    }

    public int countUserByName(String name){
        return userMapper.countUserByName(name);
    }

    public List<User> findUserList(User record){
        return userMapper.findUserList(record);
    }


}
